package com.yaDuo.common.request

import com.yaDuo.common.manager.RequestManager

/**
 * @author YaDuo
 * time 2024-11-20 20:26
 * 根据 [NetApi] 写出下面类似的全模版式的代码：后面可修改为返回 Flow 流
 */
class NetRepository private constructor() {

    companion object {
        val instance by lazy { NetRepository() }
    }

    private val service by lazy { RequestManager.instance.create(NetApi::class.java) }

    // TODO 这里后面可改为返回flow
    /** 获取分类 **/
//    fun getCategoryList() = flow { emit(service.getCategoryList()) }
    suspend fun getCategoryList() =  service.getCategoryList()

    /** 获取物料 **/
//    fun getMaterialList() = flow { emit(service.getMaterialList()) }
    suspend fun getMaterialList() = service.getMaterialList()

}
